% ==============
% math
% ==============

%index typesetting
\newcommand{\tn}[1]{\textnormal{#1}}

\newcommand{\hms}{$\textsf{hms}\!^{++}$}

\newcommand{\cpp}{C\texttt{++}}

\newcommand{\cmake}{\textsl{CMake}}

%\newcommand{\hms}{$\textsf{hms}\kern-0.05em^{++}$}

%\newcommand{\hms}{%
%	\includegraphics[height=0.5\baselineskip]{hmspp_logo_nowhite.pdf}%
%}

%% typesetting indexes upright by default ( would have to replace every instance of _\tn{} )
%\def\subinrm#1{\sb{\textnormal{#1}}}
%{\catcode`\_=13 \global\let_=\subinrm}
%\mathcode`_="8000
%\def\upsubscripts{\catcode`\_=12 } \def\normalsubscripts{\catcode`\_=8 }
%% the toggle for upright subscripts
%\upsubscripts
%% the toggle for italic subscripts
%%\normalsubscripts

%matrix typesetting
%with arrows
\newcommand{\matr}[1]{\vec{#1}} % with small arrow
%\newcommand{\matr}[1]{\overrightarrow{#1}} % bigger arrow that can span multiple characters
%without arrows
%\newcommand{\matr}[1]{\mathbf{#1}} % undergraduate algebra version
%\newcommand{\matr}[1]{#1}          % pure math version
%\newcommand{\matr}[1]{\bm{#1}}     % ISO complying version, needs bm package

% differentials
\newcommand{\dif}		{\mathop{}\!\mathrm{d}}
\newcommand{\laplace}	{\mathop{}\!\Delta}
\newcommand{\diver}		{\mathop{}\!\mathrm{div}\mathop{}\!}
\newcommand{\grad}		{\mathop{}\!\mathrm{grad}\mathop{}\!}
\newcommand{\rot}		{\mathop{}\!\mathrm{rot}\mathop{}\!}
\newcommand{\pfrac}[2]	{\frac{\partial #1}		{\partial #2}}
\newcommand{\ppfrac}[2]	{\frac{\partial^2 #1}	{\partial #2^2}}
\newcommand{\diffrac}[2]{\frac{\dif #1}			{\dif #2}}

%other symbols, quantities and expressions
\newcommand{\Rey}{\mathit{R\!e}} % \! suppresses spacing between characters
\newcommand{\Fr}{\mathit{F\!r}}
\newcommand{\Eu}{\mathit{E\!u}}
\newcommand{\Ma}{\mathit{M\kern-3pt a}}
\newcommand{\We}{\mathit{W\kern-4pt e}}
\newcommand{\Sr}{\mathit{S\!r}}
\newcommand{\NN}{\textnormal{NN}}
\newcommand{\const}{\mathrm{const.}}


% ==============
% tables
% ==============

% the command "multicolumn" is way too long
\newcommand{\mcol}[3]{\multicolumn{#1}{#2}{#3}}
% to overwrite dcolumns in header row
\newcommand{\hcel}[1]{\multicolumn{1}{c}{#1}}
% empty cells
\newcommand{\emptycells}[1]{\multicolumn{#1}{l}{}}

% horizontally centered columns
%\newcolumntype{C}[1]{>{\centering\arraybackslash}X}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

% fixed width left, center and right columns
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}

% variable width for tabularx
\newcolumntype{x}{>{\raggedright\arraybackslash}X}

\newcolumntype{z}{>{$}l<{$}} % math-mode version of "l" column type
\newcolumntype{q}{>{$}c<{$}} % math-mode version of "c" column type
\newcolumntype{y}{>{$}r<{$}} % math-mode version of "r" column type

% unit column
\newcolumntype{u}{>{$\left[}l<{\right]$}}

% math-mode version of "R", "C" and "L" column type
\newcolumntype{Z}[1]{>{$}L{#1}<{$}}
\newcolumntype{Q}[1]{>{$}C{#1}<{$}}
\newcolumntype{Y}[1]{>{$}R{#1}<{$}}

% centering on decimal point. Because of icomma package, the printed glyph has to be set to \mathord\mathcomma
\newcolumntype{d}[1]{D{,}{\mathord\mathcomma}{#1}}

% width of right column with explanations
\newlength{\ecolwidth}
\setlength{\ecolwidth}{0.4\textwidth}

% width of left column when there are no explanations
\newlength{\lcolwidth}
\setlength{\lcolwidth}{0.4\textwidth}


% ==============
% automation
% ==============

% subdirectories for importing files
\newcommand{\subf}{}


% ==============
% style and layout
% ==============

\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}}

\newcommand{\arrowItem}[1]{%
\begin{itemize}%
	\item[$\rightarrow$] #1%
\end{itemize}%
}

\newcommand{\spacedhrule}{%
	\vspace{0.2\baselineskip}
	\hrule
	\vspace{0.2\baselineskip}
}

\newcommand{\fspacedhrule}{%
	\vspace{12pt}
	\hrule
	\vspace{12pt}
}

% paragraph title with linebreak
% the starred variant will never show up in the TOC, the non-starred one may, if tocnumdepth is high enough
\makeatletter
\def\lbpar{\@ifstar\@lbpar\@starredlbpar}
\def\@lbpar#1{%
	\paragraph{#1}\mbox{}\medskip
}
\def\@starredlbpar#1{%
	\paragraph*{#1}\mbox{}\medskip
}
\makeatother

